home *** CD-ROM | disk | FTP | other *** search
-
-
-
- TTTTccccllll____AAAAddddddddEEEErrrrrrrroooorrrrIIIInnnnffffoooo((((3333)))) TTTTccccllll (((( )))) TTTTccccllll____AAAAddddddddEEEErrrrrrrroooorrrrIIIInnnnffffoooo((((3333))))
-
-
-
- _________________________________________________________________
-
- NNNNAAAAMMMMEEEE
- Tcl_AddErrorInfo, Tcl_SetErrorCode, Tcl_PosixError - record
- information about errors
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- ####iiiinnnncccclllluuuuddddeeee <<<<ttttccccllll....hhhh>>>>
-
- TTTTccccllll____AAAAddddddddEEEErrrrrrrroooorrrrIIIInnnnffffoooo(_i_n_t_e_r_p, _m_e_s_s_a_g_e)
-
- TTTTccccllll____SSSSeeeettttEEEErrrrrrrroooorrrrCCCCooooddddeeee(_i_n_t_e_r_p, _e_l_e_m_e_n_t, _e_l_e_m_e_n_t, ... ((((cccchhhhaaaarrrr ****)))) NNNNUUUULLLLLLLL)
-
- char *
- TTTTccccllll____PPPPoooossssiiiixxxxEEEErrrrrrrroooorrrr(_i_n_t_e_r_p)
-
- AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS
- Tcl_Interp *_i_n_t_e_r_p (in) Interpreter in which to
- record information.
-
- char *_m_e_s_s_a_g_e (in) Identifying string to
- record in eeeerrrrrrrroooorrrrIIIInnnnffffoooo
- variable.
-
- char *_e_l_e_m_e_n_t (in) String to record as one
- element of eeeerrrrrrrroooorrrrCCCCooooddddeeee
- variable. Last _e_l_e_m_e_n_t
- argument must be NULL.
- _________________________________________________________________
-
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- These procedures are used to manipulate two global variables
- that hold information about errors. The variable eeeerrrrrrrroooorrrrIIIInnnnffffoooo
- holds a stack trace of the operations that were in progress
- when an error occurred, and is intended to be human-
- readable. The variable eeeerrrrrrrroooorrrrCCCCooooddddeeee holds a list of items that
- are intended to be machine-readable. The first item in
- eeeerrrrrrrroooorrrrCCCCooooddddeeee identifies the class of error that occurred (e.g. |
- POSIX means an error occurred in a POSIX system call) and
- additional elements in eeeerrrrrrrroooorrrrCCCCooooddddeeee hold additional pieces of
- information that depend on the class. See the Tcl overview
- manual entry for details on the various formats for
- eeeerrrrrrrroooorrrrCCCCooooddddeeee.
-
- The eeeerrrrrrrroooorrrrIIIInnnnffffoooo variable is gradually built up as an error
- unwinds through the nested operations. Each time an error
- code is returned to TTTTccccllll____EEEEvvvvaaaallll it calls the procedure
- TTTTccccllll____AAAAddddddddEEEErrrrrrrroooorrrrIIIInnnnffffoooo to add additional text to eeeerrrrrrrroooorrrrIIIInnnnffffoooo
- describing the command that was being executed when the
- error occurred. By the time the error has been passed all
- the way back to the application, it will contain a complete
-
-
-
- Page 1 (printed 7/10/95)
-
-
-
-
-
-
- TTTTccccllll____AAAAddddddddEEEErrrrrrrroooorrrrIIIInnnnffffoooo((((3333)))) TTTTccccllll (((( )))) TTTTccccllll____AAAAddddddddEEEErrrrrrrroooorrrrIIIInnnnffffoooo((((3333))))
-
-
-
- trace of the activity in progress when the error occurred.
-
- It is sometimes useful to add additional information to
- eeeerrrrrrrroooorrrrIIIInnnnffffoooo beyond what can be supplied automatically by
- TTTTccccllll____EEEEvvvvaaaallll. TTTTccccllll____AAAAddddddddEEEErrrrrrrroooorrrrIIIInnnnffffoooo may be used for this purpose:
- its _m_e_s_s_a_g_e argument contains an additional string to be
- appended to eeeerrrrrrrroooorrrrIIIInnnnffffoooo. For example, the ssssoooouuuurrrrcccceeee command
- calls TTTTccccllll____AAAAddddddddEEEErrrrrrrroooorrrrIIIInnnnffffoooo to record the name of the file being
- processed and the line number on which the error occurred;
- for Tcl procedures, the procedure name and line number
- within the procedure are recorded, and so on. The best time
- to call TTTTccccllll____AAAAddddddddEEEErrrrrrrroooorrrrIIIInnnnffffoooo is just after TTTTccccllll____EEEEvvvvaaaallll has returned
- TTTTCCCCLLLL____EEEERRRRRRRROOOORRRR. In calling TTTTccccllll____AAAAddddddddEEEErrrrrrrroooorrrrIIIInnnnffffoooo, you may find it
- useful to use the eeeerrrrrrrroooorrrrLLLLiiiinnnneeee field of the interpreter (see
- the TTTTccccllll____IIIInnnntttteeeerrrrpppp manual entry for details).
-
- The procedure TTTTccccllll____SSSSeeeettttEEEErrrrrrrroooorrrrCCCCooooddddeeee is used to set the eeeerrrrrrrroooorrrrCCCCooooddddeeee
- variable. Its _e_l_e_m_e_n_t arguments give one or more strings to
- record in eeeerrrrrrrroooorrrrCCCCooooddddeeee: each _e_l_e_m_e_n_t will become one item of a
- properly-formed Tcl list stored in eeeerrrrrrrroooorrrrCCCCooooddddeeee.
- TTTTccccllll____SSSSeeeettttEEEErrrrrrrroooorrrrCCCCooooddddeeee is typically invoked just before returning
- an error. If an error is returned without calling
- TTTTccccllll____SSSSeeeettttEEEErrrrrrrroooorrrrCCCCooooddddeeee then the Tcl interpreter automatically sets
- eeeerrrrrrrroooorrrrCCCCooooddddeeee to NNNNOOOONNNNEEEE.
-
- TTTTccccllll____PPPPoooossssiiiixxxxEEEErrrrrrrroooorrrr sets the eeeerrrrrrrroooorrrrCCCCooooddddeeee variable after an error in |
- a POSIX kernel call. It reads the value of the eeeerrrrrrrrnnnnoooo C |
- variable and calls TTTTccccllll____SSSSeeeettttEEEErrrrrrrroooorrrrCCCCooooddddeeee to set eeeerrrrrrrroooorrrrCCCCooooddddeeee in the |
- PPPPOOOOSSSSIIIIXXXX format. In addition, TTTTccccllll____PPPPoooossssiiiixxxxEEEErrrrrrrroooorrrr returns a human- |
- readable diagnostic message for the error (this is the same
- value that will appear as the third element in eeeerrrrrrrroooorrrrCCCCooooddddeeee).
- It may be convenient to include this string as part of the
- error message returned to the application in _i_n_t_e_r_p->_r_e_s_u_l_t.
-
- It is important to call the procedures described here rather
- than setting eeeerrrrrrrroooorrrrIIIInnnnffffoooo or eeeerrrrrrrroooorrrrCCCCooooddddeeee directly with
- TTTTccccllll____SSSSeeeettttVVVVaaaarrrr. The reason for this is that the Tcl interpreter
- keeps information about whether these procedures have been
- called. For example, the first time TTTTccccllll____AAAAppppppppeeeennnnddddRRRReeeessssuuuulllltttt is
- called for an error, it clears the existing value of
- eeeerrrrrrrroooorrrrIIIInnnnffffoooo and adds the error message in _i_n_t_e_r_p->_r_e_s_u_l_t to
- the variable before appending _m_e_s_s_a_g_e; in subsequent calls,
- it just appends the new _m_e_s_s_a_g_e. When TTTTccccllll____SSSSeeeettttEEEErrrrrrrroooorrrrCCCCooooddddeeee is
- called, it sets a flag indicating that eeeerrrrrrrroooorrrrCCCCooooddddeeee has been
- set; this allows the Tcl interpreter to set eeeerrrrrrrroooorrrrCCCCooooddddeeee to
- NNNNOOOONNNNEEEE iiiiffff iiiitttt rrrreeeecccceeeeiiiivvvveeeessss aaaannnn eeeerrrrrrrroooorrrr rrrreeeettttuuuurrrrnnnn wwwwhhhheeeennnn TTTTccccllll____SSSSeeeettttEEEErrrrrrrroooorrrrCCCCooooddddeeee
- hasn't been called.
-
- If the procedure TTTTccccllll____RRRReeeesssseeeettttRRRReeeessssuuuulllltttt is called, it clears all of
- the state associated with eeeerrrrrrrroooorrrrIIIInnnnffffoooo and eeeerrrrrrrroooorrrrCCCCooooddddeeee (but it
- doesn't actually modify the variables). If an error had
- occurred, this will clear the error state to make it appear
-
-
-
- Page 2 (printed 7/10/95)
-
-
-
-
-
-
- TTTTccccllll____AAAAddddddddEEEErrrrrrrroooorrrrIIIInnnnffffoooo((((3333)))) TTTTccccllll (((( )))) TTTTccccllll____AAAAddddddddEEEErrrrrrrroooorrrrIIIInnnnffffoooo((((3333))))
-
-
-
- as if no error had occurred after all.
-
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- Tcl_ResetResult, Tcl_Interp
-
-
- KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
- error, stack, trace, variable
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 3 (printed 7/10/95)
-
-
-
-